package edu.towson.cosc603.coffeemaker;

import junit.framework.TestCase;

public class InventoryTest extends TestCase {

	private Inventory inv;
	protected void setUp() throws Exception {
		super.setUp();
		inv = new Inventory();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void testInventory() {
		Inventory inv2 = new Inventory();
		assertNotNull(inv2);
	}

	public void testGetChocolate() {
		assertEquals(inv.getChocolate(),15);
	}

	public void testSetChocolate() {
		inv.setChocolate(30);
		assertEquals(inv.getChocolate(),30);
	}
	public void testSetChocolateInvalid() {
		inv.setChocolate(-30);
		assertEquals(inv.getChocolate(),0);
	}

	public void testGetCoffee() {
		assertEquals(inv.getCoffee(),15);
	}

	public void testSetCoffee() {
		inv.setCoffee(30);
		assertEquals(inv.getCoffee(),30);
	}
	public void testSetCoffeeInvalid() {
		inv.setCoffee(-30);
		assertEquals(inv.getCoffee(),0);
	}

	public void testGetMilk() {
		assertEquals(inv.getMilk(),15);
	}

	public void testSetMilk() {
		inv.setMilk(30);
		assertEquals(inv.getMilk(),30);
	}
	public void testSetMilkInvalid() {
		inv.setMilk(-30);
		assertEquals(inv.getMilk(),0);
	}
	public void testGetSugar() {
		assertEquals(inv.getSugar(),15);
	}

	public void testSetSugar() {
		inv.setSugar(30);
		assertEquals(inv.getSugar(),30);
	}
	public void testSetSugarInvalid() {
		inv.setSugar(-30);
		assertEquals(inv.getSugar(),0);
	}

	public void testEnoughIngredients() {
		Recipe rm1 = new Recipe();
		rm1.setAmtChocolate(5);
		rm1.setAmtCoffee(5);
		rm1.setAmtMilk(5);
		rm1.setAmtSugar(5);
		rm1.setName("Hot Cocoa");
		assertTrue(inv.enoughIngredients(rm1));
		rm1.setAmtChocolate(25);
		rm1.setAmtCoffee(5);
		rm1.setAmtMilk(5);
		rm1.setAmtSugar(5);
		rm1.setName("Hot Cocoa");
		assertFalse(inv.enoughIngredients(rm1));
		rm1.setAmtChocolate(5);
		rm1.setAmtCoffee(25);
		rm1.setAmtMilk(5);
		rm1.setAmtSugar(5);
		rm1.setName("Hot Cocoa");
		assertFalse(inv.enoughIngredients(rm1));
		rm1.setAmtChocolate(5);
		rm1.setAmtCoffee(5);
		rm1.setAmtMilk(25);
		rm1.setAmtSugar(5);
		rm1.setName("Hot Cocoa");
		assertFalse(inv.enoughIngredients(rm1));
		rm1.setAmtChocolate(5);
		rm1.setAmtCoffee(5);
		rm1.setAmtMilk(5);
		rm1.setAmtSugar(25);
		rm1.setName("Hot Cocoa");
		assertFalse(inv.enoughIngredients(rm1));
	}

	public void testToString() {
		assertNotNull(inv.toString());
	}

}
